<%@page import="cn.sendto.model.ClassEntity"%>
<%@page import="java.util.List"%>
<%@page import="cn.sendto.mapper.ClassMapper"%>
<%@page import="cn.sendto.mapper.IRowMapper"%>
<%@page import="cn.sendto.dbhelper.DBHelper"%>
<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
	<%
   if(request.getSession().getAttribute("user")==null){
	   request.getRequestDispatcher("login.jsp").forward(request, response);
   }

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta charset="UTF-8">
<title></title>
<link rel="stylesheet" href="css/main.css" />
<style type="text/css">
.aaa{
	font-size: 25px;
	color: #DC143C;
	margin-right: 10%;
	text-decoration: none;
}
.aaa:hover{
	position: relative;
	top: 2px;
	right: 2px;
	color: #A52A2A;
}
</style>
<script>
			function aaa(){
				return confirm("确定删除吗？")
			}
		</script>
</head>

<body class="class_info">
<div style="width: 100%; text-align: right;  margin-top:40px;" >
<a class="aaa" href="add_class.jsp">
添加班级
</a>
</div>
	<div class="class_info_div">
		<ul>
			<li>序号</li>
			<li>名称</li>
			<li>修改</li>
			<li>删除</li>
		</ul>
		<%
	//标签名
	  String str4=">";
	  String str1="<ul><li";
	  String str2="</li><li";
	  String str3="</li></ul>";
	  //实例化
	  DBHelper helper=new DBHelper();
	  IRowMapper mapper=new ClassMapper();
	  final String QUERY="select * from classinfo";
	  //final String QUERY="select * from studentinfo ORDER BY studentid DESC";
	  //执行查询语句并返回
	  List<ClassEntity> list=helper.executeQuery(QUERY,mapper,null);
	  
	  if(list.size()!=0){
		  for(int i=0;i<list.size();i++){
			 
			  String qurey=str1+str4+list.get(i).getClassId()
					  +str2+str4+list.get(i).getClassName()
					  +str2+str4+"<a href=\"modifi_class.jsp?id="+list.get(i).getClassId()+"\">修改</a>"
					  +str2+str4+"<a href=\"delete.jsp?id="+list.get(i).getClassId()+"\" onclick=\"return aaa()\" >删除</a>"
					  +str3;
			  out.print(qurey);
		  }
	  }
	  helper.close();
	%>
	</div>
</body>

</html>